
using CStock;
using System;
using System.Diagnostics;

using NUnit.Framework;
namespace TestCases.StockData
{
	

	/// <summary>Some simple Tests.</summary>
	/// 
	[TestFixture] 
	public class DataClassTest : ProgramContext_TestCases
	{
		

		protected IDataClassFactory dataClassFactory;
        private const string shareName = "TestCaseShare";
		
        [SetUp]
		public void DataClassTestSetup()
		{
            dataClassFactory = new DataClassFactory();
            this.dataClassFactory.StockObjectBase.ID = shareName;
        }

        public IDataClassFactory DataClassFactory
		{
			get
			{
                return dataClassFactory;
			}
		}

        public IDataItem CreateDataItem(int numberOfShareValues)
        {
            IDataItem di = this.dataClassFactory.Create_NewDataClass_And_TestData("share", 10000, numberOfShareValues);

            Assert.IsTrue(di != null);
           
            return di;

        }
        [Test]
        public void CreateDataSeries_Serialize()
        {
            Assert.IsTrue(this.dataClassFactory.Create_TestData());
            this.dataClassFactory.Serialize();

        }
		
		
        //[Test] 
        //public void SaveQuotesDaily()
        //{
        //    QuoteWriter.WriteQuotesToFile((IDataClass)this.dataClassFactory.StockObject);
        //}

		[Test] 
		public void Save()
		{
            
			//take care to leave some data in the initialization
			this.dataClassFactory.Serialize( );
			//this.dataClassFactory.DataClassIntraday.Serialize( );

		}
		[Test]
        public void DeSerialize_TestCaseShare()
		{

            this.dataClassFactory.StockObjectBase.ID = shareName;
            Assert.IsTrue(this.dataClassFactory.DeSerialize());

          
		}
	
    
	}

	
}